<!DOCTYPE html>
<html lang="zh-Hans" xmlns:th="http://www.thymeleaf.org">
<head>
    <title>会诊信息列表</title>
    <div th:replace="cqzd/common/common-resource :: global-header"></div>
</head>
<body>
<div style="padding:5px;">
    <div class="search-condition">
        <div class="list">
            <div id="form1">
                <table style="width:80%;padding:5px;" class="table" >
                    <tr>
                        <td width="350px">请输入查询条件：
                            <div class="mini-autocomplete" name="patientName" style="width:200px"
                                 popupWidth="400" textField="patientName" EmptyText="身份证号/姓名/姓名简拼/卡号" valueField="patientName"
                                 url="/cqzd/do/diacinfo/queryDiacrisisInfo"  onvaluechanged="onValueChanged" >
                                <div property="columns">
                                    <div header="患者姓名" field="patientName" width="30"></div>
                                    <div header="身份证号" field="patientCardId"></div>
                                </div>
                            </div>
                        </td>


                        <td class="form_label">
                            会诊时间:
                        </td>
                        <td colspan="3">
                            <table style="border: 0px; background-color: transparent"
                                   border="0" cellspacing="0" cellpadding="0">
                                <tr style="border: 0px none; background-color: transparent;">
                                    <td style="border: 0px none; background-color: transparent;">
                                    </td>
                                    <td style="border: 0px none; background-color: transparent;">
                                        <input id="statrDate" class="mini-datepicker" name="startDate"
                                               format="yyyy-MM-dd H:mm:ss" timeFormat="H:mm:ss"
                                               showTime="true"
                                               style="width: 200px"  />
                                    </td>
                                    <td style="border: 0px none; background-color: transparent;">
                                        到:</td>
                                    <td style="border: 0px none; background-color: transparent;">
                                        <input class="mini-datepicker" name="endDate"
                                               format="yyyy-MM-dd H:mm:ss" timeFormat="H:mm:ss"
                                               showTime="true"
                                               style="width: 200px"ondrawdate="onDrawDate"  />
                            </table></td>


                        <td class="btn-wrap">
                            <input class="mini-button" text="查询" onclick="search" iconCls="icon-search"/>
                        </td>

                    </tr>

                </table>
            </div>
        </div>
    </div>
</div>

<div class="mini-fit" style="padding:0px 5px 5px 5px;">
    <div id="datagrid1" class="mini-datagrid" style="width:100%;height:100%;"
         url="cqzd/do/dibinfo/queryList" dataField="data" idField="id"  sizeList="[10,20,50,100]" multiSelect="true"  onrowdblclick="rowdblclick">
        <div property="columns">
            <div type="checkcolumn"></div>
            <div field="patientName" width="120" headerAlign="center" align="center" allowSort="true">患者姓名</div>
            <div field="dibTitle" width="120" headerAlign="center" align="center" allowSort="true">会诊标题</div>
            <div field="dibAddress" width="120" headerAlign="center" align="center" allowSort="true">会诊地点</div>
            <div field="dibTime" width="160" headerAlign="center" align="center" allowSort="true" dateFormat="yyyy-MM-dd hh:mm:ss">会诊时间</div>
            <div field="recordTime" width="160" headerAlign="center" align="center" allowSort="true" dateFormat="yyyy-MM-dd hh:mm:ss">就诊时间</div>
        </div>
    </div>
</div>

<script type="text/javascript">
    txkui.parse();

    var moduleUlr="cqzd/do/dibinfo/",modulePageUlr= getHtmlPageUrl("consultation");
    var form = new mini.Form("#form1");
    var grid = mini.get("datagrid1");
    (function(){
        grid.load();
    })();




    //双击事件
    function rowdblclick(e) {
        var row = e.row;
        $.ajax({
            url:moduleUlr+"get/"+row.dibId,
            type: "get",
            processData:false,
            contentType : false,
            success: function (result){
                console.log(result);
                mini.open({
                    url: modulePageUlr + "dib_detail.html",
                    title: "查看会诊信息", width: 1000, height: 600,
                    onload: function () {
                        var iframe = this.getIFrameEl();
                        var data = result;
                        iframe.contentWindow.SetData(data);
                    },
                    ondestroy: function (action) {
                        if(action=="ok"){
                            grid.reload();
                        }
                    }
                });
            }
        })
    }

    // 搜索框改变事件
    function onValueChanged() {
        search();
    }


    function search(){
        //校验
        form.validate();
        if (form.isValid()===false) return;

        var formData = form.getData(true, true);

        //var json = mini.encode(formData);
        grid.load(formData);
    }

    $(function () {
        $(".mini-autocomplete .mini-buttonedit-input").attr("placeholder","身份证号/姓名/姓名简拼/卡号");
    });

</script>

</body>
</html>